<template></template>

<script setup>
  import { defineProps, reactive, watch } from 'vue';
  import { useStore } from 'vuex';
  import { useRoute } from 'vue-router';

  /**
   * 接收mis传递过来的token
   * 并存入本地
   */

  const route = useRoute();
  const store = useStore();

  const { token = '' } = route.query;

  if (token.indexOf('Bearer ') > -1) {
    // Login
    store.dispatch('$setToken', token);
    window.location.href = window.location.origin;
  } else {
    // Logout
    store.dispatch('$setToken', '');
    window.location.href = import.meta.env.VITE_LOGIN_SITE;
  }
</script>

<style lang="less" scoped></style>
